home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / C / ASAP / textfont.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-09-09  |  3.3 KB  |  94 lines

  1. /*****************************************************************************
  2.  *                                                                           *
  3.  * ASAP - Amiga Software Authoring Platform                                  *
  4.  *                                                                           *
  5.  * Written by Laurie Perrin                                                  *
  6.  *                                                                           *
  7.  * ATextFont wrapper class                                                   *
  8.  *                                                                           *
  9.  *****************************************************************************/
  10.  
  11. #ifndef ASAP_ATextFont_H
  12. #define ASAP_ATextFont_H
  13.  
  14. #include <New.h>
  15.  
  16. extern "C"
  17. {
  18.  #include <Proto/DiskFont.h>
  19.  #include <Proto/Graphics.h>
  20. }
  21.  
  22. class ATextFont : public TextFont
  23. {
  24.  public:
  25.  inline void AddFont();
  26.  inline void CloseFont();
  27.  inline void operator delete(void *textFont);
  28.  inline ULONG ExtendFont(TagItem * fontTags);
  29.  inline ULONG ExtendFontTags(unsigned long tag1Type,  ...);
  30.  inline void FontExtent(struct TextExtent * fontExtent);
  31.  inline static ATextFont * OpenDiskFont(TextAttr * textAttr);
  32.  inline void * operator new(size_t, TextAttr * textAttr, BOOL disk = 0);
  33.  inline static ATextFont * OpenFont(TextAttr * textAttr);
  34.  inline void RemFont();
  35.  inline void StripFont();
  36. };
  37. //----------------------------------------------------------------------------
  38. void ATextFont::AddFont ()
  39. {
  40.  ::AddFont(this);
  41. }
  42. //----------------------------------------------------------------------------
  43. void ATextFont::CloseFont ()
  44. {
  45.  ::CloseFont(this);
  46. }
  47. //----------------------------------------------------------------------------
  48. void ATextFont::operator delete (void *textfont)
  49. {
  50.  ((ATextFont *) textfont)->CloseFont();
  51. }
  52. //----------------------------------------------------------------------------
  53. ULONG ATextFont::ExtendFont (TagItem * fontTags)
  54. {
  55.  return ::ExtendFont(this, fontTags);
  56. }
  57. //----------------------------------------------------------------------------
  58. ULONG ATextFont::ExtendFontTags (unsigned long tag1Type,  ...)
  59. {
  60.  return ATextFont::ExtendFont((TagItem *) &tag1Type);
  61. }
  62. //----------------------------------------------------------------------------
  63. void ATextFont::FontExtent (struct TextExtent * fontExtent)
  64. {
  65.  ::FontExtent(this, fontExtent);
  66. }
  67. //----------------------------------------------------------------------------
  68. ATextFont * ATextFont::OpenDiskFont (TextAttr * textAttr)
  69. {
  70.  return (ATextFont *) ::OpenDiskFont(textAttr);
  71. }
  72. //----------------------------------------------------------------------------
  73. void * ATextFont::operator new(size_t, TextAttr * textAttr, BOOL disk)
  74. {
  75.  return disk? ATextFont::OpenDiskFont(textAttr) : ATextFont::OpenFont(textAttr);
  76. }
  77. //----------------------------------------------------------------------------
  78. ATextFont * ATextFont::OpenFont (TextAttr * textAttr)
  79. {
  80.  return (ATextFont *) ::OpenFont(textAttr);
  81. }
  82. //----------------------------------------------------------------------------
  83. void ATextFont::RemFont ()
  84. {
  85.  ::RemFont(this);
  86. }
  87. //----------------------------------------------------------------------------
  88. void ATextFont::StripFont ()
  89. {
  90.  ::StripFont(this);
  91. }
  92.  
  93. #endif
  94.